﻿using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using WebApi.Core.IRepository;
using WebApi.Core.Model;
using WebApi.Core.Repository.Base;
using WebApi.Core.Repository.SqlSugar;
     
namespace WebApi.Core.Repository
{
    public class UserRepository : BaseRepository<Users>, IUserRepository
    {
        private readonly ILogger<UserRepository> _logger;

        public UserRepository(ILogger<UserRepository> loger) :base(loger)
        {
            _logger = loger;
        }

        public async Task<Users> GetUserAsync(Users user)
        {
            return await _db.Queryable<Users>().Where(x => (x.UserId == user.UserId || x.UserName == user.UserId)).FirstAsync();
        }

    }
}
